package com.newtouch.bxzs.database.synchronize.batch.process;

import com.newtouch.bxzs.common.base.util.PinYinUtils;
import com.newtouch.bxzs.database.synchronize.model.CustomerBO;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.stereotype.Component;

/**
 * 客户同步数据处理
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/1/7 10:58</td>
 * <td>Amour</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author yuanjie
 * @version 1.0.0
 * @since 1.0.0
 */
@Component

public class ProcesorCustomer {

    /**
     * 处理客户信息
     * @return ItemProcessor
     */
    public ItemProcessor<CustomerBO, CustomerBO> processorCustomer(){
        return customer -> {
            //处理数据
            customer.setCustomerNameFullSpelling(PinYinUtils.toPinyin(customer.getCustomerName()));
            customer.setCustomerLabel("3");
            return customer;
        };
    }
}
